home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / PAGE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  4KB  |  128 lines

  1. /* $Id: page.h,v 1.24 1998/10/20 03:09:16 jj Exp $ */
  2.  
  3. #ifndef _SPARC64_PAGE_H
  4. #define _SPARC64_PAGE_H
  5.  
  6. #define PAGE_SHIFT   13
  7. #ifndef __ASSEMBLY__
  8. /* I have my suspicions... -DaveM */
  9. #define PAGE_SIZE    (1UL << PAGE_SHIFT)
  10. #else
  11. #define PAGE_SIZE    (1 << PAGE_SHIFT)
  12. #endif
  13.  
  14. #define PAGE_MASK    (~(PAGE_SIZE-1))
  15.  
  16.  
  17. #ifdef __KERNEL__
  18.  
  19. #ifndef __ASSEMBLY__
  20.  
  21. extern void clear_page(unsigned long page);
  22. extern void copy_page(unsigned long to, unsigned long from);
  23.  
  24. /* GROSS, defining this makes gcc pass these types as aggregates,
  25.  * and thus on the stack, turn this crap off... -DaveM
  26.  */
  27.  
  28. /* #define STRICT_MM_TYPECHECKS */
  29.  
  30. #ifdef STRICT_MM_TYPECHECKS
  31. /* These are used to make use of C type-checking.. */
  32. typedef struct { unsigned long pte; } pte_t;
  33. typedef struct { unsigned long iopte; } iopte_t;
  34. typedef struct { unsigned int pmd; } pmd_t;
  35. typedef struct { unsigned int pgd; } pgd_t;
  36. typedef struct { unsigned long ctxd; } ctxd_t;
  37. typedef struct { unsigned long pgprot; } pgprot_t;
  38. typedef struct { unsigned long iopgprot; } iopgprot_t;
  39.  
  40. #define pte_val(x)    ((x).pte)
  41. #define iopte_val(x)    ((x).iopte)
  42. #define pmd_val(x)      ((unsigned long)(x).pmd)
  43. #define pgd_val(x)    ((unsigned long)(x).pgd)
  44. #define ctxd_val(x)    ((x).ctxd)
  45. #define pgprot_val(x)    ((x).pgprot)
  46. #define iopgprot_val(x)    ((x).iopgprot)
  47.  
  48. #define __pte(x)    ((pte_t) { (x) } )
  49. #define __iopte(x)    ((iopte_t) { (x) } )
  50. #define __pmd(x)        ((pmd_t) { (x) } )
  51. #define __pgd(x)    ((pgd_t) { (x) } )
  52. #define __ctxd(x)    ((ctxd_t) { (x) } )
  53. #define __pgprot(x)    ((pgprot_t) { (x) } )
  54. #define __iopgprot(x)    ((iopgprot_t) { (x) } )
  55.  
  56. #else
  57. /* .. while these make it easier on the compiler */
  58. typedef unsigned long pte_t;
  59. typedef unsigned long iopte_t;
  60. typedef unsigned int pmd_t;
  61. typedef unsigned int pgd_t;
  62. typedef unsigned long ctxd_t;
  63. typedef unsigned long pgprot_t;
  64. typedef unsigned long iopgprot_t;
  65.  
  66. #define pte_val(x)    (x)
  67. #define iopte_val(x)    (x)
  68. #define pmd_val(x)      ((unsigned long)(x))
  69. #define pgd_val(x)    ((unsigned long)(x))
  70. #define ctxd_val(x)    (x)
  71. #define pgprot_val(x)    (x)
  72. #define iopgprot_val(x)    (x)
  73.  
  74. #define __pte(x)    (x)
  75. #define __iopte(x)    (x)
  76. #define __pmd(x)        (x)
  77. #define __pgd(x)    (x)
  78. #define __ctxd(x)    (x)
  79. #define __pgprot(x)    (x)
  80. #define __iopgprot(x)    (x)
  81.  
  82. #endif /* (STRICT_MM_TYPECHECKS) */
  83.  
  84. #define TASK_UNMAPPED_BASE    ((current->tss.flags & SPARC_FLAG_32BIT) ? \
  85.                  (0x0000000070000000UL) : (PAGE_OFFSET))
  86.  
  87. #endif /* !(__ASSEMBLY__) */
  88.  
  89. /* to align the pointer to the (next) page boundary */
  90. #define PAGE_ALIGN(addr)    (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  91.  
  92. #ifndef __ASSEMBLY__
  93. /* Do prdele, look what happens to be in %g4... */
  94. register unsigned long page_offset asm("g4");
  95. #define PAGE_OFFSET        page_offset
  96. #else
  97. #define PAGE_OFFSET        0xFFFFF80000000000
  98. #endif
  99.  
  100. #define __pa(x)            ((unsigned long)(x) - PAGE_OFFSET)
  101. #define __va(x)            ((void *)((unsigned long) (x) + PAGE_OFFSET))
  102. #define MAP_NR(addr)        (__pa(addr) >> PAGE_SHIFT)
  103.  
  104. #ifndef __ASSEMBLY__
  105.  
  106. /* The following structure is used to hold the physical
  107.  * memory configuration of the machine.  This is filled in
  108.  * probe_memory() and is later used by mem_init() to set up
  109.  * mem_map[].  We statically allocate SPARC_PHYS_BANKS of
  110.  * these structs, this is arbitrary.  The entry after the
  111.  * last valid one has num_bytes==0.
  112.  */
  113.  
  114. struct sparc_phys_banks {
  115.   unsigned long base_addr;
  116.   unsigned long num_bytes;
  117. };
  118.  
  119. #define SPARC_PHYS_BANKS 32
  120.  
  121. extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
  122.  
  123. #endif /* !(__ASSEMBLY__) */
  124.  
  125. #endif /* !(__KERNEL__) */
  126.  
  127. #endif /* !(_SPARC64_PAGE_H) */
  128.